package com.china.api.wechat;

import java.io.FileWriter;
import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.Gson;

/**
 * 
 * @Description: 生成aptJson.js
 * @author:zhaoxudong
 * @version:v1.0.0
 * @Created:2013-12-19下午4:37:54
 * @Modified:
 */
public class AirPortJS {

	private static final Logger log = LoggerFactory.getLogger(AirPortJS.class);
	/**
	 *
	 * @Description:
	 * @param args void
	 * @Created:zhaoxudong 2013-11-11上午10:57:48
	 * @Modified:
	 */

	public static void main(String[] args) {
		init();
	}
	/**
	 * 
	  *
	  * @Description: void
	  * @Created:zhaoxudong 2013-12-19下午4:37:34
	  * @Modified:
	 */
	private static void init() {
		
	}

	private static void generateAirPortJS(String path, String json) {

		log.info("save "+path+" init...");
		log.info("json : "+json);
		String rel = json.replace("\"", "\'");
		String jsStr = "var json = \""+rel+"\";";
		FileWriter js = null;
		try {
			js = new FileWriter(path);
			js.write(jsStr);
			js.flush();
		} catch (IOException e) {
			log.info("save "+path+" is error!");
			e.printStackTrace();
		}finally{
			try {
				js.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		log.info("save "+path+" finished...");
	}

}
